﻿using System;

namespace CoreEx.Common.Validation
{
    /// <summary>
    /// Represents a validation rule.
    /// </summary>
    /// <typeparam name="T">The type that this <see cref="IValidationRule{T}"/> applies to.</typeparam>
    public interface IValidationRule<T>
    {
        /// <summary>
        /// Gets or sets the message used when the rule is broken.
        /// </summary>
        string Message { get; set; }

        /// <summary>
        /// Gets or sets the function delegate that points to the validating code. 
        /// </summary>
        Func<T, bool> Rule { get; set; }
    }    
}
